TextAid is a multi-tasking application which has been designed to work alongside other applications on the Acorn desktop to provide text handling facilities which are not normally available to those applications. These facilities can be summarised as follows:
These facilities will provide an extremely useful addition to the facilities normally available from within text editors, word processors, DTP packages, spreadsheets, databases and any other applications which handle text in any way. The text macro and text transfer facilities (numbers 1 & 2 above) should work with any multi-tasking applications which can accept text input from the keyboard.
Warning: TextAid provides facilities that are normally unavailable under RISC OS. There is a small price to pay for this flexibility: you should not type anything at the keyboard or press any mouse buttons while any insertion process is in operation, as this may affect the operation of TextAid or other applications.
TextAid is run in the usual way, by double-clicking on its icon in a directory display. The TextAid icon will appear on the icon bar. If you are starting up TextAid from a boot sequence it is possible to arrange for a macro file to be loaded automatically at start-up. Simply add the name of the macro file to the line in your boot file which runs TextAid, separated by a space; for example:
Run adfs::HardDisc.$.Apps.!TextAid
adfs::HardDisc.$.Documents.Macros
Run adfs::HardDisc.$.Apps.!TextAid
adfs::HardDisc.$.Documents.Macros -open
Clicking the Menu button over the icon bar icon will display a menu containing eight options: Info, Open window, Increment 1, Increment 2, Define codes, Hot keys, Warning and Quit.
The Increment 1, Increment 2, Define codes, Hot keys and Warning options will be explained later in this manual.
The Info option displays a standard information box about the program. This includes the version number of the software, which you should quote if ever you need to contact the publisher with queries or problems.
The Quit option terminates TextAid and removes it from the icon bar.
The Open window option leads to a submenu which contains five options: Macros, Codes, Quick macros, Transfer and Convert. Each of these refers to one of TextAid's windows, and apart from Quick macros, each of these windows provides one of the application's facilities. Choosing one of these options will toggle the corresponding window open or closed. If a window is open, that menu option will be ticked. We will now describe each facility in turn.
To the left of each writable icon is an icon containing a red arrow. Clicking on this with Select will insert the macro from the corresponding writable icon in TextAid's window into the document or icon which currently contains the caret, irrespective of which application it belongs to. For example, if you have an Edit or Impression document open on the desktop, and the caret is in this document, then clicking on one of TextAid's arrow icons will insert the corresponding text into the document at the caret position.
Alternatively you may want to delete some text at the destination before the new text is inserted. If you click on the arrow icon with Adjust, then if the caret is in a writable icon, all the text in that icon will be deleted before the insertion is made. If on the other hand the caret is in a document, any marked text will be deleted first. This will only work for document editors which use the key sequence Ctrl-X to delete marked text. However, this is a fairly standard convention so it should work with many applications. Clearly this action is potentially destructive, so TextAid issues a warning before deleting any text in a document. If you are sure you do not need the warning facility, it can be switched off via the Warning option on the icon bar menu.
This method of inserting macros will not work if the caret is inside a dialogue box, since the box will disappear when you click on the arrow. An alternative method of inserting macros is provided for such circumstances: move the pointer over the required red arrow and press the Alt key. This will insert the macro just as if the arrow had been clicked. There is no option to delete text first if you use this method.
Note that if the caret is not visible on the desktop (i.e. no document has the input focus), TextAid will issue a warning. Similarly, a warning will be given if you try to insert a macro into itself.
Clicking Menu over one of TextAid's windows displays a four-option menu: Info, Open window, Save macros and Clear macros. The Info and Open window options are exactly the same as the options on the icon bar menu, and were described above. The other two options refer to the macros in the main window and are greyed out unless you have opened the menu over that window. Choosing the Clear macros option will erase all the macros currently defined in the window, and empty the writable icons. Since this is a destructive action, a warning will be given before it is carried out to enable you to abort the action if you wish.
You may also load a macro file into TextAid. Any file may be dragged either to the icon bar icon or into the main window. The first 20 lines in any such file will be assumed to be text macros and will be inserted into the 20 writable icons, truncating any lines which are over 80 characters long.
|| | inserts the vertical bar character itself. |
|D (or |d) | When this is encountered in a macro, the current date is substituted. The format of the date is determined by a system variable TextAid$Date, which is defined in the application's !Run file (see 'Time and date' below). The default format is "(d)d month yyyy" (for example, "3 June 1992" or "25 December 1981"). |
|F (or |f) | inserts a function key code. It should be followed by a digit from 0 to 9 to indicate which function key is required, e.g. |F4. This allows you to build sequences of key presses for dialogue boxes, e.g. find/replace in Edit. Thus the following macro would replace all occurrences of "Window Manager" with "Wimp" in an Edit document:
|F4Window Manager|NWimp|N|F5|F1
|
|T (or |t) | substitutes the current time, read from the computer's real-time clock. The format for this is determined by another system variable, this time TextAid$Time. This is also defined in the !Run file. The default is "(h)h.mm" in 12-hour format (e.g. "10.51 am" or "2.35 pm"). |
|N (or |n) | inserts a new line, in other words ASCII code 13. Most applications will start a new line on receipt of this code; if you come across an application which does not, it will be necessary to insert the new line manually by pressing Return. |
|K (or |k) | enables you to insert control codes that simulate other non-character keys being pressed (e.g. cursors, Delete, Copy etc.). |K should be followed by two further characters. The first determines whether the key is simulated on its own or in conjunction with Shift and/or Ctrl, as follows:
S - key + Shift C - key + Ctrl A - key + Shift-Ctrl (i.e. "A" for all) The second character determines which key is simulated, as follows:
R - right cursor U - up cursor D - down cursor T - tab I - insert H - home E - delete (i.e. "E" for erase) C - copy P - print All characters can be in upper or lower case. So for example the sequence |kkc would simulate the pressing of the Copy key on its own, while |kcr would simulate the right cursor key plus Ctrl. |
|M (or |m) | followed by a 2-digit decimal number can be used to insert another of TextAid's macros. In other words, macro 1 could contain the command |M02. When macro 1 is inserted into a document, it will then contain the text of macro 2 at the point where the command was inserted. This feature allows you to build very long macro strings (i.e. 19 x 80 characters). Macros can only be nested to one level; in other words, in the example given above, if macro 2 itself contained a |M command, this would be ignored. |
|I (or |i) | inserts an incremented figure, the initial value being taken from the icon bar menu option previously mentioned (see below). Using this facility you could, for example, number paragraphs successively using a macro such as "Paragraph |I". Each time this is inserted, the value will increase, so that you will see "Paragraph 1", Paragraph 2" and so on.
There are in fact two increments which can be used independently of each other. If |I is followed immediately by "1" or "2" (e.g. "Item |I1", "Paragraph |I2") then Increment 1 or Increment 2 will be used respectively; otherwise Increment 1 will be used. By default, the values for each increment start at 1 and increase by 1 each time a value is inserted by TextAid. However, both the next value to be inserted and the incremental step can be altered from the menu options. Both the Increment 1 and Increment 2 options on the icon bar menu lead to a submenu with two further options: Next and Step. Each of these options leads to a writable icon into which you can type any numeric value. Whatever values are in the writable icons at the time of inserting the increment will be used by the program; for example, if Next = 10 and Step = 5, the next increment to be inserted will be "10", and the following ones will be "15", "20" and so on, unless the values are altered in the meantime from the menu. |
Secondly, by switching on the Hot keys option from the icon bar menu, macros can be inserted simply by pressing the Alt key together with a function key (F1 to F10 for macros 1-10, Shift-F1 to Shift-F10 for macros 11-20). There is no option to delete text before insertion if you use this method. When the Hot keys option is on, the menu item will be ticked. If you find that other applications recognise these key sequences and interfere with TextAid, it is better to leave the option switched off.
The purpose of this window is to insert control codes into Edit or other similar editors which will invoke specific printer functions when a text file containing these codes is sent to a printer. Normally it is not possible to print out a document from Edit in this way, unless the actual sequences of codes recognised by the printer are manually inserted into the document. Even this is very difficult to do, since most printer functions make use of the Escape code (ASCII 27), and it is not possible to insert this code into Edit directly, but only by a very long-winded process.
To make use of this facility, you need to understand a little of how your printer works, and also how the RISC OS printer drivers work. In order to tell a printer that you want it to print the next section of text in bold or italic, say, you must send it a precise sequence of control codes. This sequence usually starts with Escape (ASCII 27) - this does not correspond to any printable character (the printable character set starts at 32) and so the printer cannot mistake it for a standard character. The codes which follow the Escape code depend on the function which you wish to set, and these will be described in your printer manual. Most printers which are described as "Epson-compatible" will use the same set of codes for any particular function as any other similar printer.
What TextAid does is to insert into the document either the full literal sequence of codes required by the printer (if the Literal icon is selected), or a single code from the non-printable area of the ASCII set (if Shortcode is selected) which acts as a marker and will be expanded by the printer driver into the full set at the time of printing. The latter is achieved by making use of a facility within the RISC OS printer drivers to intercept any code in the ASCII set and replace it with another code or codes before sending on to the printer.
This is how it works in practice: first of all, the five printer functions provided are user-definable, so if you want to access elite, condensed, double-height or any other printer function, you can customise TextAid to do so. The five functions provided as the default with the package are Bold, Superscript, Italic, Underline and Subscript. To change these to other functions, open the icon bar menu and move to the dialogue box which appears from the Define codes option. On the left-hand side are five writable icons containing the names of the printer functions you wish to use. You may type any names you like into these icons (maximum 10 characters), and these will then be displayed in the Codes window.
Next you must set up the printer codes required by the printer to implement the functions you have chosen. To the right of each of the five icons is a further pair of writable icons, into which you should type the printer's code sequences to switch the function on and off respectively. This takes the form of a string of decimal numbers corresponding to the code sequence, the numbers being separated by commas. For example, your printer manual may say that the code sequence for switching on bold is ESC "E" or CHR$27+CHR$69. What this means is that you must send the ASCII character 27 (Escape) followed by 69 ("E"). To put this sequence into TextAid's dialogue box, the string would therefore read 27,69. Similarly, the sequence to turn off underlining might be ESC "-" 0, which would translate to 27,45,0.
The sequences for producing the five default functions on an Epson-compatible printer are already included. However, even if you stick to the default functions, you may need to alter these sequence strings if you have a non-standard printer.
When you have altered all the settings in the dialogue box to suit your own requirements, click on the OK icon to register them as the current set. Clicking on the Cancel icon will restore the former settings. The set of function names and printer codes can be saved so that they will appear in future as the defaults. To do this, simply click on the Save status icon in the dialogue box.
An AppChoices file is supplied with TextAid, containing the names Edit, SrcEdit and DeskEdit. These are currently the only editors which use the correct sequence of routines to allow TextAid's control code facility to work, and so you will not normally need to alter this file. The ability to do so is included in case other editors based on the text editing routines used by Edit are released at a later date. It must be stressed that this restriction on application names applies only to the Codes facility, and not the macro facility described above or to the Transfer facility to be described later. In these cases, any application which owns the caret can be the recipient, and it does not have to be specifically named in any way.
Getting back to printer control codes, you can decide whether to insert single codes or full sequences by selecting the appropriate radio icon in the Codes window, as mentioned above. If the Shortcode icon is selected, single codes will be sent; if the Literal icon is selected, the full sequence will be sent (known as a "literal code sequence"). Provided that the application which owns the caret is one of those contained in the AppChoices file, then clicking on one of the On or Off icons will insert the code or codes into the document.
If you are inserting single codes, the code will be one of the set of symbols between ASCII 128 and 140 (e.g. a tick or an arrow). Incidentally, the codes used for bold, italic and underline are the same as those used for these functions in DeskEdit, so if you create a document in, say, Edit or SrcEdit with control codes, that document can later be printed from DeskEdit and the codes will be interpreted correctly.
There is a further icon in the Codes window, labelled Escape. This allows you to include an actual Escape character (ASCII 27) into the document, which is very difficult to do by any other method. You might want to do this if, for example, you want to build printer control sequences directly into your text other than those which are set up in TextAid. The process by which the code is put into the document is a convoluted one, and is not quite instantaneous. You should not perform any other functions until the process is finished and you can see the Escape code in the document (which will be displayed as "[1b]" by Edit, for example).
If you have inserted shortcodes into your document, you need to do a little more work before you see the results on the printer. This is because the printer driver needs to be told how to interpret these codes. Acorn has provided a facility to do this, which differs according to whether you have RISC OS 2 or RISC OS 3. For RISC OS 2, this involves modifying a file called PrDataSrc within the printer driver's application directory. If you load this file into Edit, you will see a section not far from the beginning of the file headed Printable character translations. Underneath this will be one or more lines beginning:
text_charnnn: "string"
TextAid provides a shortcut for you to do this. Once you have set up all the printer codes you require in the dialogue box, clicking on the Save codes icon will display a save box, initially with a default filename of CharCodes. Dragging the file icon to a directory display will save a file of that name, which will contain a series of lines to be inserted into the PrDataSrc file. Each of these lines will be of the form described above, and nnn in each case will be replaced by the ASCII code of the appropriate shortcode character. All you need to do is to insert these lines into the PrDataSrc file at some point in the Printable character translations section.
This is not quite the end of the story, since the PrDataSrc file itself is not used by the printer driver; instead a compressed version called PrData is used. Instructions for compressing PrDataSrc into PrData are given in the printer driver's help file.
If you have RISC OS 3, things are much simpler. Firstly, load your printer definition file into the PrintEdit application, as explained in the User Guide. Now select the icon marked Edit character mappings, and modify the mappings to suit the functions you wish to access from TextAid. The five functions, Bold, Superscript, Italic, Underline and Subscript, make use of codes 128-132 to switch on, and 136-140 to switch off, in the order given. So if the code sequence for your printer to switch on bold is ESC "E", then you must map character 128 to 27,"E". By looking at the mappings already listed in the window you will see how to do this.
Choosing the Transfer option from the Open window submenu opens a small window containing a writable icon and two further icons labelled Transfer in and Transfer out. To operate the transfer facility, first click over the Transfer in icon. The legend will change to Waiting... to indicate that TextAid is now waiting for you to transfer text. Now click again over the icon or title bar containing the text you wish to transfer, and it will be transferred into the writable icon in the Transfer window. The string may be up to 80 characters long, and will be truncated if it is longer. Note that once you have clicked on Transfer in to activate the process, normal multi-tasking is suspended until the next click of the mouse.
It is also possible to transfer text directly from a document editor into the Transfer window, provided that the editor is able to save a selection of text as a text file. For example, using Edit you can save a marked section of text as a file by choosing the Save option from the Select submenu. If you drag such a file directly into TextAid's Transfer window, the first line of the file, or the first 80 characters if the line is longer than this, will be inserted into the transfer icon. This allows you to transfer text directly from a document into a writable icon belonging to another application via TextAid, which is virtually impossible to do by any other method.
The string in the Transfer window can be edited, or you can transfer it straight out to the caret position by clicking on the Transfer out icon. As before, clicking with Adjust instead of Select enables you to delete text at the destination before the insertion is made. This operates in exactly the same way as described earlier.
For single-key transfer, the keys you press depend on whether you wish to delete text at the destination first. To transfer text without deletion, all you have to do is to position the pointer over the icon or title bar containing the text you wish to transfer, and press the Insert key while holding down Alt. The text will be transferred directly to the caret position, but will not appear in TextAid's Transfer window. To delete text first, just use Alt-Delete instead. The single-key transfer facility makes it extremely easy to move text about on the desktop, by moving the pointer around with one hand and pressing the appropriate keys with the other.
Just as with the macro facility described above, by using either of the transfer methods the text can be inserted into any writable icon or document which contains the caret, irrespective of the application which owns it. This facility has a great many uses; for example, you could transfer long pathnames from Filer window title bars without needing to type the whole name yourself; or you could transfer the results of a calculation from a spreadsheet or calculator into a text document, and so on.
To use the facility, open the Convert window and select the appropriate radio icon: CSV to text, Text to CSV, TSV to text, Text to TSV or Text to text. Now drag the file to be converted into the Convert window. After a short pause while the data is converted, a standard save box will appear. This will contain the pathname of the original file, so if you wish to save it back with its original name all you need to do is to click on OK or press Return. Alternatively you may amend the name and then save it in the same way, or drag the file icon to a different directory display.
Text and CSV files are saved with the appropriate filetype, and when converting from CSV or text TextAid will only accept files with the correct type (&FFF for text and &DFE for CSV). However, there is no filetype for TSV files, so these files are saved untyped. TSV files are rarely used on the Acorn, and the most likely reason for converting to TSV would be for use on a different system. When converting from TSV, TextAid will accept any filetype, but will then check to see if there are tab characters in the file. If not, it will assume that the file is not TSV and will generate an error.
IF key%>180 AND key%
block%=24:block%!16=&820C0:block%!20=key%-&180
SYS "Wimp_SendMessage",17,block%,0
ENDIF
Provided that TextAid is installed, this will result in the macro which corresponds to the function key pressed being inserted at the caret.
Set TextAid$Date %ZDY %MO %CE%YR
Set TextAid$Time %Z12.%MI %AM
To understand the format used, and to set your own, you should study the description of system variables in your User Guide, in particular the section on date and time. TextAid uses exactly the same format as described in the User Guide.
Copyright © Rheingold Enterprises 1993